﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BindShowText : MonoBehaviour
{
    public Transform bindCamera;
    public bool isBind=true;
    private Transform TrhpText;
    private Transform TrshowText;

    public int hp;
    public string showText;

    public void setHpNub(int nub)
    {
        //TrhpText.GetComponent<TextMesh>().text = "\n\n\t\t\tHP:"+nub.ToString();
        hp = nub;
    }

    public void setShowText(string str)
    {
        //showText.GetComponent<TextMesh>().text = str + "\n\n";
        showText = str;
    }

    public void showHp()
    {
        TrhpText.GetComponent<TextMesh>().text = "\n\n\t\t\tHP:" + hp.ToString();
    }

    public void showShowText()
    {
        TrshowText.GetComponent<TextMesh>().text = showText + "\n\n";
    }

    //public void hideHp()
    //{
    //    TrhpText.GetComponent<TextMesh>().text = "";
    //}

    //public void hideShowText()
    //{
    //    TrshowText.GetComponent<TextMesh>().text = "";
    //}

    // Start is called before the first frame update
    private void Awake()
    {
        TrhpText = transform.Find("HP");
        TrshowText = transform.Find("ShowText");
    }

    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (isBind)
        {
            transform.position = bindCamera.position;
            transform.rotation = bindCamera.rotation;
        }
    }
}
